﻿using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;


namespace One.Models
{
    [Table("article")] 
    public class Article
    {
        public Article()
        {
            Tags = new List<Tag>();
        }

        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        [MaxLength(100)]
        public string Title { get; set; }

        [MaxLength(100)]
        public string SubTitle { get; set; }

        //public int Category { get; set; }

        //public int DisplayCategory { get; set; }

        [MaxLength(200)]
        public string AuthIt { get; set; }

        [MaxLength(200)]
        public string AuthorIntroduce { get; set; }
        
        public string Content { get; set; }

        [DataType(DataType.Date)]
        [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
        public DateTime HpMakeTime { get; set; }

        [MaxLength(200)]
        public string GuideWord { get; set; }

        [MaxLength(100)]
        public string WebUrl { get; set; }

        [MaxLength(50)]
        public string EditorEmail { get; set; }

        [MaxLength(100)]
        public string ImageUrl { get; set; }
        
        public int AuthorId { get; set; }

        [ForeignKey("AuthorId")]
        public virtual Author Author { get; set; }
        
        public virtual List<Tag> Tags { get; set; }
    }
}
